package com.danny.demo.entity;

import java.io.Serializable;
import java.util.Objects;

/**
 * @ClassName: User
 * @Description: TODO
 * @Author: zhangdong
 * @Date: Created in 10:51 2019/6/19
 * @Version:
 */
public class User implements Serializable{

    private String userName;
    private String userAge;
    private String userSex;
    private static String userPhone;//序列化不保存静态变量
    private transient String userHobby;//transient是类型修饰符，只能用来修饰字段。在对象序列化的过程中，标记为transient的变量不会被序列化。
    private static final long serialVersionUID = 3347057485741365610L;

    public User() {}
    public User(String userName, String userAge, String userSex, String userHobby) {
        this.userName = userName;
        this.userAge = userAge;
        this.userSex = userSex;
        this.userHobby = userHobby;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserAge() {
        return userAge;
    }

    public void setUserAge(String userAge) {
        this.userAge = userAge;
    }

    public String getUserSex() {
        return userSex;
    }

    public void setUserSex(String userSex) {
        this.userSex = userSex;
    }

    @Override
    public String toString() {
        return "User{" +
                "userName='" + userName + '\'' +
                ", userAge='" + userAge + '\'' +
                ", userSex='" + userSex + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(userName, user.userName) &&
                Objects.equals(userAge, user.userAge) &&
                Objects.equals(userSex, user.userSex) &&
                Objects.equals(userHobby, user.userHobby);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userName, userAge, userSex, userHobby);
    }

}
